package upload

type Upload interface {
	SetKey(string, string) Upload
	SetBucket(string) Upload
	Upload(File) (FormData, error)
}

type upload struct {
	client uploadInterface
}

//Client 进行实例化
func Client(name string) Upload {
	return (&upload{}).init(name)
}

func (upload *upload) init(name string) Upload {
	switch name {
	case "qiniu":
		upload.client = new(qiniuEnter)
	}
	return upload
}

func (upload *upload) SetKey(ak string, as string) Upload {
	upload.client.SetKey(ak, as)
	return upload
}

func (upload *upload) SetBucket(bucket string) Upload {
	upload.client.SetBucket(bucket)
	return upload
}

func (upload *upload) Upload(file File) (FormData, error) {
	return upload.client.Upload(file)
}
